#pragma once
#include <vector>
#include "FvMesh.h"
#include "DeepArray.h"
namespace LxCFD
{
    class FluentMeshBase
    {
    public:
        struct Face
        {
        public:
            ShallowArray Nodes;
            int c0;
            int c1;
            //void Set(ShallowArrayStorage &store, const std::vector<std::string>& ss);
        };
        class FlHead : public HeadBase
        {
        public:
            IndexRecorder Index;
            void SetHead(const std::vector<std::string> &splitedStrings);
        };
        class FlThread : public FlHead
        {
        public:
            std::vector<Face> Faces;
            FvContact *RootContact;
        };
        enum class FThreadTypes
        {
            interior,
            boundary,
            interface_c0,
            interface_c1,
        };
        class FlZone : public FlHead
        {
        public:
            std::vector<FlThread *> Threads;
            std::vector<FThreadTypes> ThreadsType;
            void AddThread(FlThread *flThread, FThreadTypes fThreadType);
            void AddToFvZone(FvMesh &mesh);
        };

        std::vector<Vector3d> FlNodes;
        std::vector<std::unique_ptr<FlZone>> FlZones;
        std::vector<std::unique_ptr<FlThread>> FlThreads;
        DeepArray ShallowArrayStorage;
        void ConvertToMesh();
        void RemarkID();
        int FindZoneByCell(int cellID);
        void DistributeThreadsToFlZone(FvMesh &mesh);
        void DistributeNodesToFvZone(FvMesh &mesh);
    };
}